<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
		<script type="text/javascript">
			// 定义构造函数
			// 注意它如何初始化this函数
			function Rectangle(w,h){
				this.width = w;
				this.height = h;
			}
			// 调用构造函数创建两个矩形对象
			// 注意，我们把宽度和高度传递给了构造函数，这就他就能正确初始化每个新对象了
			var rect1 = new Rectangle(2,4);
			var rect2 = new Rectangle(8.5,11);
			console.log(rect1.height);
			console.log(rect2.height,rect2.width);
		</script>
	</head>
	<body>

	</body>
</html>
